package com.bestcem.xm.ticket.service;

import com.bestcem.xm.common.core.domain.web.ServiceResult;
import com.bestcem.xm.ticket.controller.param.ticket.config.CreateConfigParam;
import com.bestcem.xm.ticket.controller.param.ticket.config.UpdateConfigParam;
import com.bestcem.xm.ticket.controller.vo.ticket.config.TicketConfigInfoVO;
import com.bestcem.xm.ticket.enums.TicketConfigStateEnum;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/18 11:07
 */
public interface TicketConfigService {
    /**
     * 查询工单配置详情信息
     *
     * @param id 工单配置id
     * @return 详情信息
     * @author liheng
     * @date 2021/8/25 13:53
     */
    ServiceResult<TicketConfigInfoVO> getTicketConfig(String id);


    /**
     * 更新工单规则的 标题
     *
     * @param id    工单规则id
     * @param title 新标题
     * @return 根据 result 的 success 判断成功与否
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/8/18 14:07
     */
    ServiceResult<Object> updateTicketConfigTitle(String id, String title);

    /**
     * 更新工单规则的 状态
     *
     * @param id    工单规则id
     * @param state 新状态
     * @return 根据 result 的 success 判断成功与否
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/8/18 14:38
     */
    ServiceResult<Object> updateTicketConfigState(String id, TicketConfigStateEnum state);

    /**
     * 创建工单配置
     *
     * @param param 参数
     * @return 新建工单配置id
     * @author liheng
     * @date 2021/8/25 13:52
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    ServiceResult<String> insertTicketConfig(CreateConfigParam param);


    /**
     * 修改工单配置
     *
     * @param id    工单配置id
     * @param param 修改工单配置参数
     * @return 工单配置id
     * @author liheng
     * @date 2021/8/25 13:52
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    ServiceResult<String> updateTicketConfigV2(String id, UpdateConfigParam param);
}
